RUN=g++
CFLAGS=-std=c++20 -g -c
DIRS=
LIBRARIES=-lncurses
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXEC=exec

.PHONY: all clean run reload push setup

all: $(DIRS) $(SOURCES) $(EXEC)

$(DIRS):
	+$(MAKE) -C $@

$(EXEC): $(OBJECTS)
	$(RUN) $(LIBRARIES) $(OBJECTS) -o $(EXEC)

.cpp.o:
	$(RUN) $(CFLAGS) $<

clean:
	find . -name \*.o -type f -delete
	find . -name \$(EXEC) -type f -delete

run: all
	./$(EXEC)

reload: clean all

push:
	git add .
	git commit -F commit.md
	git push main main

setup:
	cp -a ~/Projects/preset/. ./
	git init
	git branch -m main
	git config user.name Florane
	git config user.email qwerty.qa912@gmail.com
	read input; git remote add main "https://notabug.org/Florane/$$input$0.git"
